/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

/**
 * <p>Project: javase - TypeConvert
 * <p>Powered by webrx On 2021-11-22 09:32:02
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class TypeConvert {
    public static void main(String[] args) {
        //数据类型转换
        //1. 自动转换
        int a = 3;
        long b = a; //自动隐式转换
        //2. 强制类型转换
        byte c = (byte) a;//强制转换
        byte c2 = Byte.parseByte(String.valueOf(a));
        System.out.println(c);//3
        System.out.println(c2);//3


        short n = 0;
        n += 1;
        System.out.println(n);//1


        n = (short) (n + 1);
        System.out.println(n);//2

    }
}
